<template>
	<view>
			<u-navbar back-icon-color="#fff" title-color="#fff" title="学生错题" :border-bottom="false"></u-navbar>
			<view class="group">
				<my-empty v-if="empyFalse" emptyTit="您还没有发布考试，快去创建吧~"></my-empty>
				<my-an-item v-else  @click.native="gotoLink(paper.examId,paper.number)"
				:key="paper.examId"
				v-for="paper in list"
				:item="paper" :itemName="paper.examName" >
				<view slot="botLeft"><my-icon name="time"></my-icon><text class="botTxt">交卷时间：{{paper.endTime}}</text></view>
				<view slot="botRight"><my-icon name="wrongNum"></my-icon><text class="botTxt">错题数：{{paper.wrongs}}</text></view>
				<view slot="right" class="rightIcon">
					<my-icon name="chakantimu" class="yellow ft40"></my-icon>
				</view>
				</my-an-item>
			</view>
	</view>
</template>

<script>
	import exam from '../../mixins/exam.js';
	export default{
		mixins: [exam],
		data() {
			return {
				list: [],
				empyFalse:false
			}
		},
		onLoad() {
			this.init();
		},
		methods: {
			// 默认
			init() {
				this.list=[];
				return this.getDataList();
			},
			// 跳转链接
			gotoLink(examid,number){
					const apiSetting = { method: 'get', url: `/app/teacher/home/stuWrongQuesDetail/${examid}` };
					const answerPageSetting = {
						correcting: true,
						clearHistoryHandler: 'clearPracticeHistory',
						correctTopic: true,
						initArguments: [true],
						isStudent:true,
					};
					answerPageSetting.examid=examid
					answerPageSetting.autoJump = null;
					answerPageSetting.topicNumber=number
					answerPageSetting.isRecitation = true;
					answerPageSetting.clearHistory = false;
					answerPageSetting.navTitle = '错题详情';
					answerPageSetting.updateHistoryHandler = 'updateRecitationHistory';
					this.startAnswer(apiSetting, answerPageSetting);
			},
			// 获取列表
		  getDataList(){
				 return new Promise((resolve, reject) => {
				 	this.request
				 		.get('/app/teacher/home/stuWrongQues')
				 		.then(res => {
				 			this.list = res;
							this.empyFalse=this.list.length>0?false:true
				 			resolve();
				 		})
				 		.catch(reject);
				 });
			 }
		}
	}
</script>
<style>
page {
	background-color: #f5f5f5;
}
</style>
<style lang="scss" scoped>
	.group{background: #fff;}
  .botTxt{margin-left: 0upx;}
	.rightIcon{
		position: absolute;
		right: 28upx;
	}
	.empty{
		position: absolute!important;
		height: 100%!important;
	}
	/deep/.name_bot_r{
		padding-left: 25upx;
	}
</style>
